<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
cfc('core')->checklogin();
set_html('title','我的订单');
if($_RQ['op']=='main'){
	$return['setting']=$this->plugin_setting('page');
	$params=array('uniacid'=>$_SESSION['uniacid']);
    $orderby='level asc';
	$total='';
	$levels=pdo_getall('jy_teamfee_level',$params,array(),'',$orderby);
	foreach($levels as &$item){
		$params=array('mid'=>$_SESSION['uid'],'level'=>$item['id']);
		if(isset($_RQ['type'])){
			$params['type']=$_RQ['type']!=0?$_RQ['type']:array(0,3);
		}
		$item['num']=pdo_count('jy_teamfee_commission',$params);
	}
	$return['levels']=$levels;
	$return['params']=array(
		'level'=>$levels['id'],
		'page'=>1,
	);
	$params=array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid']);
	if(isset($_RQ['type'])){
		$params['type']=$_RQ['type']!=0?$_RQ['type']:array(0,3);
		$return['params']['type']=$_RQ['type'];
	}
	$return['commission_money']=pdo_getsum('jy_teamfee_commission',$params,'money');
	$return['commission_total']=pdo_count('jy_teamfee_commission',$params);
	$return['list']=array();
	$return['psize']=20;
	exi($return);
}
?>